package org.dromara.web.plugins.file;


import org.springframework.stereotype.Component;

import java.io.File;
import java.io.FileInputStream;

@Component
public class TXTFileResolver implements FileResolver{

    @Override
    public String resolve(String path) {
        try {
            File file = new File(path);
            FileInputStream fis = new FileInputStream(file);
            String content = new String(fis.readAllBytes());
            return content;
        }catch (Exception e) {

        }
        return "";
    }

    @Override
    public String[] supportedExtensions() {
        return new String[]{"txt"};
    }
}
